home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 426-450 / disk_436 / input / console.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  1KB  |  52 lines

  1. /*******************************
  2. *  CONSOLE  08/04/90
  3. *  Written by Timm Martin 
  4. *  This code is public domain.
  5. ********************************/
  6.  
  7. #include <devices/console.h>
  8. #include <exec/devices.h>
  9. #include <exec/types.h>
  10. #include <functions.h>
  11. #include "input.h"
  12.  
  13. struct Device *ConsoleDevice = NULL;
  14. struct IOStdReq ConsoleReq;
  15. long ConsoleError = TRUE;
  16.  
  17. /****************
  18. *  CONSOLE OPEN
  19. *****************/
  20.  
  21. /* 
  22. This function attempts to open the console device.  TRUE or FALSE is returned
  23. whether it was successful.
  24. */
  25.  
  26. BOOL console_open( void )
  27. {
  28.   if (!(ConsoleError = OpenDevice( "console.device", -1L,
  29.                                  (struct IORequest *)&ConsoleReq, NULL )))
  30.     ConsoleDevice = ConsoleReq.io_Device;
  31.  
  32.   return (ConsoleError == FALSE);
  33. }
  34.  
  35. /*****************
  36. *  CONSOLE CLOSE
  37. ******************/
  38.  
  39. /* 
  40. This procedure closes the console device if it was opened and resets the
  41. corresponding pointers.
  42. */
  43.  
  44. void console_close( void )
  45. {
  46.   if (!ConsoleDevice)
  47.   {
  48.     CloseDevice( (struct IORequest *)&ConsoleReq );
  49.     ConsoleDevice = NULL;
  50.   }
  51. }
  52.